Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make servlet3 + spring webmvc + jaxrs 2.0 indy compatible #12432

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

SylvainJuge
Copy link
Contributor

part of #11457

@SylvainJuge SylvainJuge mentioned this pull request Oct 10, 2024
36 tasks
@SylvainJuge SylvainJuge changed the title make servlet3 indy compatible make servlet3 + spring webmvc indy compatible Oct 10, 2024
}
Object bean = springCtx.getBean("otelAutoDispatcherFilter");
OpenTelemetryHandlerMappingFilter filter;
if (bean instanceof OpenTelemetryHandlerMappingFilter) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[for reviewer] this is an edge-case where the inlined advice will be able to directly call the OpenTelemetryHandlerMappingFilter class directly and with indy we get a proxy instance that needs to be unwrapped (thus the delegate fields needs to be made public for simplicity).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to add a TODO here to drop this branch when we remove support for inlined advice then maybe?


Object bean = springCtx.getBean("otelAutoDispatcherFilter");
OpenTelemetryHandlerMappingFilter filter;
if (bean instanceof OpenTelemetryHandlerMappingFilter) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[for reviewer] this is an edge-case where the inlined advice will be able to directly call the OpenTelemetryHandlerMappingFilter class directly and with indy we get a proxy instance that needs to be unwrapped (thus the delegate fields needs to be made public for simplicity).

@SylvainJuge SylvainJuge marked this pull request as ready for review October 29, 2024 09:27
@SylvainJuge SylvainJuge requested a review from a team as a code owner October 29, 2024 09:27
@SylvainJuge SylvainJuge changed the title make servlet3 + spring webmvc indy compatible make servlet3 + spring webmvc + jaxrs 2.0 indy compatible Oct 29, 2024
}
Object bean = springCtx.getBean("otelAutoDispatcherFilter");
OpenTelemetryHandlerMappingFilter filter;
if (bean instanceof OpenTelemetryHandlerMappingFilter) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to add a TODO here to drop this branch when we remove support for inlined advice then maybe?

if (bean instanceof OpenTelemetryHandlerMappingFilter) {
// inline advice: no proxy class is used
filter = (OpenTelemetryHandlerMappingFilter) bean;
} else {
Copy link
Contributor

@laurit laurit Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo instead of doing the reflection here there should be an API to do this. Something that would unwrap the object when it is proxy and return the input when it is not. So you could write OpenTelemetryHandlerMappingFilter filter = = (OpenTelemetryHandlerMappingFilter) unwrap(springCtx.getBean("otelAutoDispatcherFilter"));
I guess using the reflection as currently is fine for start. Instead of making the delegate field public I'd probably try to make the proxy instance implement an interface that allow unwrapping. If needed that interface could be hidden from reflection

Idk how hard all of this would be to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants